﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;

namespace InscriberDataManager
{
    /// <summary>
    /// Interaction logic for GroupEdit.xaml
    /// </summary>
    public partial class GroupEdit : Window
    {
        DataTable tb;

        public GroupEdit()
        {
            InitializeComponent();
            dataGrid1.ItemsSource = Functionality.LoadDataGroups();
        }

        

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            Close();
        }

        private void addGroup_Click(object sender, RoutedEventArgs e)
        {
            if (!textBox1.Text.Equals(""))
            {
                Functionality.addSportGroup(textBox1.Text);
                textBox1.Text = "";
            }
            dataGrid1.ItemsSource = Functionality.LoadDataGroups();
        }

        private void deleteGr_Click(object sender, RoutedEventArgs e)
        {
            Functionality.deleteGroup(dataGrid1);
            dataGrid1.ItemsSource = Functionality.LoadDataGroups();
        }
    }
}
